<!DOCTYPE html>
<p>Test of createContextualFragment from a Range whose container is an SVG document. If the test succeeds you will see the word "PASS" below.</p>
<p id="result"></p>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function onSvgLoad()
{
    window.svgDocument = document.getElementById('container').getSVGDocument();
    window.range = svgDocument.createRange();
    window.fragment = range.createContextualFragment('<text id="fragment" x="0" y="16" fontsize="16">Inserted fragment</text>');
    window.svg = svgDocument.firstElementChild;
    svg.appendChild(fragment);
    window.text = svgDocument.getElementById('fragment');

    window.result = document.getElementById('result');
    result.textContent = (text && text.parentElement === svg && text.namespaceURI === 'http://www.w3.org/2000/svg') ? 'PASS' : 'FAIL';

    if (window.testRunner)
        testRunner.notifyDone();
}
</script>
<embed id="container" src="resources/svg-document.svg" onload="onSvgLoad();" />
</embed>
